package com.eboss2.sbs.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;

import com.eboss2.sbs.R;
import com.eboss2.sbs.activity.base.BaseActivity;
import com.mytools.tool.activityManager.MyActivityManager;

@SuppressLint("JavascriptInterface")
public class WebViewActivity extends BaseActivity implements View.OnClickListener{

	public static String HTTP_CONTENT = "HTTP_CONTENT";
	public static String WEBVIEW_TITLE = "WEBVIEW_TITLE";
	
    private String title;
    private String http_content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        setContentView(R.layout.activity_webview);
        MyActivityManager.getInstance().addActivity(this);

        http_content = getIntent().getStringExtra(HTTP_CONTENT);
        title = getIntent().getStringExtra(WEBVIEW_TITLE);
        
		showView(R.id.titleback_btn_back, true);
		setTvText(R.id.tv_title, title);
		
		findViewById(R.id.titleback_btn_back).setOnClickListener(this);
        
        WebView webview = (WebView)findViewById(R.id.webview);
        webview.getSettings().setDefaultTextEncodingName("UTF-8");
        webview.loadData(http_content, "text/html; charset=UTF-8", null);

    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
    }
    
    @Override
    public void onClick(View v) {
    	switch (v.getId()) {
			case R.id.titleback_btn_back:
				finish();
				break;
			default:break;
		}
    }
}
